﻿function parseText(id, t) {
    var textarea = window.opener.document.getElementById(id);
    var doc = textarea.document;
    if (doc) {
        textarea.focus();
        doc.selection.createRange().collapse;
        textarea.document.selection.createRange().text = t;
    }
    else if (textarea.selectionStart || textarea.selectionStart == '0') {
        var s = textarea.selectionStart;
        var e = textarea.selectionEnd;
        var val = textarea.value;
        var start = val.substring(0, s);
        var end = val.substring(e);
        textarea.value = start + t + end;
    }
    textarea.focus();
}
